package com.shenhaofeng.app.download;

import android.os.Parcel;
import android.os.Parcelable;


/**
 * Created by Administrator on 2016/9/14.
 */
public class DownloadRequest implements Parcelable ,Cloneable{


    protected String url;

    protected String fileName;


    /**
     * 默认的构建方法,构建一个新的下载请求对象
     */
    DownloadRequest() {

    }


    @Override
    public DownloadRequest clone() throws CloneNotSupportedException {
        DownloadRequest request = (DownloadRequest) super.clone();
        request.url = url;
        request.fileName = fileName;
        return request;
    }


    @Override
    public int describeContents() {
        return 0;
    }


    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.url);
        dest.writeString(this.fileName);
    }


    protected DownloadRequest(Parcel in) {
        this.url = in.readString();
        this.fileName = in.readString();
    }


    public static final Creator<DownloadRequest> CREATOR = new Creator<DownloadRequest>() {
        @Override
        public DownloadRequest createFromParcel(Parcel source) {
            return new DownloadRequest(source);
        }


        @Override
        public DownloadRequest[] newArray(int size) {
            return new DownloadRequest[size];
        }
    };
}
